<?php
    session_start();
    $_SESSION['count_file'] = "0";
    if (count($_FILES)) {
        // Handle degraded form uploads here.  Degraded form uploads are POSTed to index.php.  SWFUpload uploads
        // are POSTed to upload.php
    }

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>

<title>SWFUpload Demos - Multi-Instance Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
        echo $html->css('swfupload.css');
        echo $html->script(array('swfupload.fileprogress.js',
                                'swfupload.handlers.js',
                                'swfupload.js',
                                'swfupload.queue.js'
                                )
                            );
?>
<script type="text/javascript">
        var upload1, upload2;
        window.onload = function() {
            upload1 = new SWFUpload({
                // Backend Settings
                upload_url: "<?php echo $html->url($upload_url) ?>",
                post_params: {"PHPSESSID" : "<?php echo session_id(); ?>"},

                // File Upload Settings
                file_size_limit : "<?php echo $file_size_limit?>",	// 100MB
                file_types : "<?php echo $file_types ?>",
                file_types_description : "<?php echo $file_types_description ?>",
                file_upload_limit : "<?php echo $file_upload_limit ?>",
                file_queue_limit : "<?php echo $file_queue_limit ?>",

                // Event Handler Settings (all my handlers are in the Handler.js file)
                file_dialog_start_handler : fileDialogStart,
                file_queued_handler : fileQueued,
                file_queue_error_handler : fileQueueError,
                file_dialog_complete_handler : fileDialogComplete,
                upload_start_handler : uploadStart,
                upload_progress_handler : uploadProgress,
                upload_error_handler : uploadError,
                upload_success_handler : uploadSuccess,
                upload_complete_handler : uploadComplete,

                // Button Settings
                button_image_url : "<?php echo $button_image_url ?>",
                button_placeholder_id : "spanButtonPlaceholder1",
                button_width: 61,
                button_height: 22,

                // Flash Settings
                flash_url : "/share/swfupload.swf",


                custom_settings : {
                    progressTarget : "fsUploadProgress1",
                    cancelButtonId : "btnCancel1"
                },

                // Debug Settings
                debug: false
            });
         }
        function disableContextMenu(element) {
            element.oncontextmenu = function() {
               return false;
            }
        }

        function onLoad() {
            disableContextMenu(document.getElementById("fsUploadProgress1"));
        }
    </script>
</head>
<body>
<div id="content">
    <form id="form1" action="index.php" method="post" enctype="multipart/form-data">
        <table>
            <tr valign="top">
                <td>
                  <div >
                        <div class="fieldset flash" onclick="return false" id="fsUploadProgress1" style="height:200px; overflow: auto;">

                        </div>
                        <div style="padding-left: 5px;">
                            <span id="spanButtonPlaceholder1"></span>
                            <input id="btnCancel1" type="button" value="Cancel Uploads" onclick="cancelQueue(upload1);" disabled="disabled" style="margin-left: 2px; height: 22px; font-size: 8pt;" />
                            <br />
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </form>
</div>
</body>
</html>
